<?php 
require dirname ( __FILE__ ) . '/lib/init.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title></title>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/jquery.form.js"></script>
	<script type="text/javascript" src="js/jquery.validate.js"></script>
	<script type="text/javascript" src="js/jquery.validate.methods.js"></script>
	<script type="text/javascript" src="js/lang/zh-cn.js"></script>
	<script type="text/javascript" src="js/datepicker.js"></script>
	<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
	<link rel="stylesheet" type="text/css" href="css/datepicker.css" />
	<link rel="stylesheet" type="text/css" href="css/base.css" />
	<script type="text/javascript">
	
		$(function(){

			$("#contentform").validate({
				rules: {
					news_title:"required",
					news_date:{ "required":true, "date":true },
					//news_image:{ "required":true, "accept":"image/*" },
					news_content:"required"
				},
				messages: {
					news_title:" 请填写新闻标题!",
					news_date:{"required":" 请填写新闻日期!", "date":" 请填写正确的日期格式!"},
					//news_image:{ "required":" 请选择新闻图片!", "accept":" 请选择图像格式!" },
					news_content:" 请填写新闻内容!"
				},
				submitHandler: function(form) {
					CKEDITOR.instances["news_content"].updateElement();
					$("#contentSubmit").attr({'disabled':'disabled'});
					$("#contentform").ajaxSubmit({
						success:function(data){
							parent.parent.maincenter.location = 'news_list.php';
							parent.parent.show_alert(data);
							parent.parent.close_dialog("NEWSADD");
						}
					});
					return false;
				}
			});
		});
	</script>
</head>
<body>
<div id="content_form">
	<form id="contentform" name="contentform" action="action/newsAction.php" method="post" enctype="multipart/form-data">
		<table width="750" border="0" cellpadding="0" cellspacing="0" align="left">
			<tr>
				<td height="35" colspan="2" style="padding-left:34px">
					<span><strong>注:</strong>带<span class="warninfo">*</span>的为必填项目!</span>
					<input type="hidden" name="useraction" value="NEWSADD" id="useraction"/>
				</td>
			</tr>
			<tr><td height="25" colspan="2" style="padding-left:34px"><div id="state_div"></div></td></tr>
			<tr>
                <td width="100" align="right" valign="middle" height="35"><span class="warninfo">*</span>&nbsp;新闻标题:</td>
                <td class="pleft" align="left" valign="middle"><input type="text" name="news_title" id="news_title" value="" class="inputtext"/></td>
            </tr>
			<tr>
				<td width="100" align="right" valign="middle" height="35"><span class="warninfo">*</span>&nbsp;新闻日期:</td>
				<td class="pleft" align="left" valign="middle"><input type="text" name="news_date" id="news_date" value="" class="dateformat-Y-ds-m-ds-d no-animation disable-drag" readonly="readonly"/></td>
			</tr>
			
			<tr>
				<td width="100" align="right" valign="top" height="35" class="ptop" style="padding-top: 7px;"><span class="warninfo">*</span>&nbsp;新闻内容:</td>
				<td class="pleft" align="left" valign="middle" style="padding-top: 7px;">
					<textarea cols="10" id="news_content" name="news_content" rows="10"></textarea>
					<script type="text/javascript">
						CKEDITOR.replace("news_content",{height:"220px",width:'500px'});
					</script>
				</td>
			</tr>
			<tr>
                <td width="100" align="right" valign="middle" height="35"><span class="warninfo">*</span>&nbsp;新闻标题:</td>
                <td class="pleft" align="left" valign="middle">
                	<select name="news_showtype" id="news_showtype">
                		<option value="1">无图</option>
                		<option value="2">有图</option>
                	</select>
                </td>
            </tr>
            <tr>
				<td width="100" align="right" valign="middle" height="35"><span class="warninfo">*</span>&nbsp;新闻图像:</td>
				<td class="pleft" align="left" valign="middle"><input type="file" name="news_image" id="news_image" value="" /></td>
			</tr>
			<tr>
				<td height="35">&nbsp;</td>
				<td class="pleft"><input type="submit" name="contentSubmit" id="contentSubmit" value="提交" /></td>
			</tr>
		</table>
	</form>
</div>
</body>
</html>